package com.exam.teacher.mapper;

import com.exam.entity.*;
import com.exam.entity.dto.ScoreDto;
import com.exam.entity.dto.StudentDto;
import com.exam.entity.dto.TeacherDto;
import com.exam.entity.vo.ExamVo;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TeacherMapper {

    /**
     * 根据id来删除试卷
     * @param examCode
     * @return
     */
    @Delete("delete from exam_manage where examCode = #{examCode}")
    int deleteExamById(Long examCode);

    /**
     * 添加考试信息
     * @param examManage
     * @return
     */
    int insertExam(ExamManage examManage);

    List<PaperManage> getByPaperId(PaperManage paperManage);

    /**
     * 查询所有的题目
     * @return
     */
    Page<ExamVo> selectAllQuestion();

    /**
     * 添加选择题
     * @param multiQuestion
     * @return
     */
    int addMultiQuestion(MultiQuestion multiQuestion);

    /**
     * 添加试卷管理
     * @param paperManage
     * @return
     */
    int addExamManage(PaperManage paperManage);

    /**
     * 添加填空题
     * @param fillQuestion
     * @return
     */
    int addFillQuestion(FillQuestion fillQuestion);

    /**
     * 添加判断题
     * @param judgeQuestion
     * @return
     */
    int addJudgeQuestion(JudgeQuestion judgeQuestion);

    /**
     * 查询所有的学生
     * @return
     */
    Page<Student> findAllStudent();

    /**
     * 根据学生id查询该学生所有的分数
     * @param scoreDto
     * @return
     */
    List<Score> findByStudentIdScore(ScoreDto scoreDto);

    /**
     * 学生管理编辑回显学生数据
     * @param studentDto
     * @return
     */
    Student findByIdStudent(StudentDto studentDto);

    /**
     * 根据id删除用户信息
     * @param studentId
     * @return
     */
    int deleteByIdStudent(Long studentId);

    /**
     * 添加学生
     * @param studentDto
     * @return
     */
    int insertStudent(StudentDto studentDto);

    /**
     * 查找所有的教师分页
     * @return
     */
    @Select("select * from teacher")
    Page<Teacher> findAllTeacher();

    /**
     * 根据id删除教师信息
     * @param teacherId
     * @return
     */
    int deleteByIdTeacher(Long teacherId);

    /**
     * 插入教师数据
     * @param teacherDto
     * @return
     */
    int insertTeacher(TeacherDto teacherDto);
}
